class Solution {
public:
    vector<int> circularPermutation(int n, int start) {
        vector<int> a{0, 1};
        for (int i = 1; i < n; i ++ ) {
            vector<int> b = a;
            for (int j = a.size() - 1; j >= 0; j -- )
                b.push_back(a[j] + (1 << i));
            a = b;
        }

        for (int& x: a) x ^= start;
        return a;
    }
};

作者：yxc
链接：https://www.acwing.com/activity/content/code/content/3668890/
来源：AcWing
著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。